﻿using System;
using System.Collections.Generic;
using System.Text;
using YT.DB;
using YT.Commons;

using System.Drawing.Imaging;
using System.Drawing.Printing;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using Microsoft.Reporting.WinForms;
using System.Windows.Forms;


using Excel = Microsoft.Office.Interop.Excel;
using System.Reflection;

namespace YT.XH.IgE.Reports
{
    public class Report
    {
        public void OeDailyCashSalesPaymentReport(DBAccess dbcon, PrintInfo printInfo,bool blnWithAll)
        {
            string strRptDataSourceName, strRptName;
            Reports.OeDailyCashSalesPaymentRpt oeDailyCashSalesPaymentRpt =new Reports.OeDailyCashSalesPaymentRpt();
            OeDailyCashSalesPaymentRptTableAdapters.DataTable1TableAdapter dataTable1TableAdapter = new Reports.OeDailyCashSalesPaymentRptTableAdapters.DataTable1TableAdapter();
            dataTable1TableAdapter.Connection = (System.Data.SqlClient.SqlConnection)dbcon.Con;
            strRptDataSourceName = "OeDailyCashSalesPaymentRpt_DataTable1";
            strRptName = "YT.XH.IgE.Reports.IgEDetectInfoRptWithAll.rdlc";
            if (!blnWithAll) strRptName = "YT.XH.IgE.Reports.IgEDetectInfoRptWithOutValue.rdlc";
            dataTable1TableAdapter.ClearBeforeFill = true;
            oeDailyCashSalesPaymentRpt.EnforceConstraints = false;
            string strSQL = "select * from #tmpDetectInfo";
            DataSet ds = dbcon.GetDataSet(strSQL);
            ds.Tables[0].TableName = "DataTable1";
            ReportParameter ReportTitle = new ReportParameter("Title", "");
            ReportParameter PageTitle = new ReportParameter("PageTitle", printInfo.ReportPageTitle);
            ReportParameter[] rptParaArray = new ReportParameter[] { ReportTitle, PageTitle };
            frmPrintView f1 = new frmPrintView();
            f1.OutPutReport(printInfo, strRptDataSourceName, strRptName, ds, rptParaArray);

        }


        public void OeDailyCashSalesPaymentReport(DBAccess dbcon, PrintInfo printInfo)
        {
            
            string strRptDataSourceName, strRptName;
            Reports.OeDailyCashSalesPaymentRpt oeDailyCashSalesPaymentRpt = new Reports.OeDailyCashSalesPaymentRpt();
            OeDailyCashSalesPaymentRptTableAdapters.DataTable1TableAdapter dataTable1TableAdapter = new Reports.OeDailyCashSalesPaymentRptTableAdapters.DataTable1TableAdapter();
            dataTable1TableAdapter.Connection = (System.Data.SqlClient.SqlConnection)dbcon.Con;
            strRptDataSourceName = "OeDailyCashSalesPaymentRpt_DataTable1";
            strRptName = "YT.XH.IgE.Reports.IgEdiDgnosisRptWithAll.rdlc";
         
            dataTable1TableAdapter.ClearBeforeFill = true;
            oeDailyCashSalesPaymentRpt.EnforceConstraints = false;
            string strSQL = "select * from #tmpDetectInfo";
            DataSet ds = dbcon.GetDataSet(strSQL);
            ds.Tables[0].TableName = "DataTable1";
            ReportParameter ReportTitle = new ReportParameter("Title", "");
            ReportParameter PageTitle = new ReportParameter("PageTitle", printInfo.ReportPageTitle);
            ReportParameter IsDemo = new ReportParameter("IsDemo", SysVar.IsDemo.ToString ());

            ReportParameter[] rptParaArray = new ReportParameter[] { ReportTitle, PageTitle, IsDemo };
            frmPrintView f1 = new frmPrintView();
            f1.OutPutReport(printInfo, strRptDataSourceName, strRptName, ds, rptParaArray);

        }

    }
}
